package edu.ccut.titan.core.impl;

import org.osgi.framework.BundleContext;

import edu.ccut.titan.service.ITitanManagerService;
import edu.ccut.titan.service.ServiceFactory;

/**
 * 解析"META-INF/titan-component.xml"下的组件信息 把组件信息加载或卸载到IComponentManagerService中
 * 
 * @author LeslieGu
 * 
 */
public class ComponentResolver {

	private ITitanManagerService componentManagerService = null;

	public void loadComponent(BundleContext context) {
		this.componentManagerService = ServiceFactory
				.getComponentManagerService(context);
		this.componentManagerService
				.addBundle(context.getBundle());
	}

	public void unlodaComponent(BundleContext context) {
		this.componentManagerService.removeBundle(context
				.getBundle());
		
		this.componentManagerService = null;
	}
}
